<template>
  <div class="dashboard-container">
    <h3> 洪焕民 1903010115</h3>
    <div>学校数量：{{schoolNum}}</div>
    <div>学院数量：{{academyNum}}</div>
    <div>班级数量：{{classsNum}}</div>
    <div>学生数量：{{studentNum}}</div>
    <div>老师数量：{{teacherNum}}</div>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
    name:'Dashboard',
    data(){
      return{
        schoolNum:0,
        academyNum:0,
        classsNum:0,
        studentNum:0,
        teacherNum:0,
      }
    },
    computed: {
      ...mapGetters([
        'name'
      ])
    },
    mounted(){
      this.$http.get('/api/users/add').then(res => {
        console.log('this.panels', res)
      })
        this.$http.post('./api/school/find').then(res => {
          if(res&&res.length>0){
            this.schoolNum=res.length
            console.log('res;',res.length)
          }
      })
      this.$http.post('./api/academy/find').then(res => {
          if(res&&res.length>0){
            this.academyNum=res.length
            console.log('res;',res.length)
          }
      })
      this.$http.post('./api/classs/find').then(res => {
          if(res&&res.length>0){
            this.classsNum=res.length
            console.log('res;',res.length)
          }
      })
      this.$http.post('./api/student/find').then(res => {
          if(res&&res.length>0){
            this.studentNum=res.length
            console.log('res;',res.length)
          }
      })
      this.$http.post('./api/teacher/find').then(res => {
          if(res&&res.length>0){
            this.teacherNum=res.length
            console.log('res;',res.length)
          }
      })
    }
  }
</script>